Repository navigation
feat(agent): ping Ollama and explain why it isn't answering - #402
Merged
Merged
Conversation
Add GET /agent/ollama/health: checks the configured Ollama server
(/api/tags, 3s timeout) and reports ok / unreachable / model_missing /
no_model with the model name and pulled models.
The chat panel pings it on mount and when the Ollama URL or model
changes, and shows a banner with the fix ("ollama serve" or
"ollama pull <model>", copyable) and a Retry button. A failed Ollama
turn re-pings and replaces the raw provider error with the same advice.
Only shown when Ollama is the active provider.
Closes #303
The API answers any origin (CORS *), so a web page could call
/agent/ollama/health with any base_url and read the result, turning it into a
probe of the user's network. Accept only http(s) loopback URLs without
credentials (400 otherwise), don't follow redirects, and report generic
reasons ("connection refused", "timed out", "not an Ollama server") instead of
echoing the upstream status or exception text.
Refs #303
lightningpixel
force-pushed
the
feat/303-ollama-error-ux
branch
from
November 11, 2026 09:42
ea567a5 to
374b8e5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #303
What changes
When Ollama is the active provider, the chat panel checks it on open, on URL/model change, on Retry, and after a failed turn. If something is wrong, an amber banner says why and gives the fix to copy:
unreachableollama servemodel_missingollama pull <m>no_modelA chat turn that fails while Ollama is down shows the same advice instead of the raw provider error. Other providers (local llama.cpp, external APIs) are unaffected.
Backend:
GET /agent/ollama/health?base_url=&model=checks<root>/api/tagswith a 3 s timeout. An untagged model name matches:latest.Security (second commit): the API answers any origin (
CORS *), so a web page could use this endpoint to probe the user's network.localhost,127.0.0.1,::1); anything else gets a 400.detailfield is generic (connection refused/timed out/not an Ollama server) and never echoes the upstream status or body.The Ollama preset is already fixed at
localhost:11434, so this costs nothing today. A remote Ollama would need an explicit allowlist later.Merge note
This PR conflicts with #401 (#302) on the
ChatPanel.tsximport lines only, and the two work together. Whichever merges second needs a one-line rebase; I'll handle it.Test plan
python -m unittest tests.test_agent_ollama_health: 13 OK (statuses, tag matching, timeout, rejection of non-local URLs, generic detail)ollamaHealth.test.ts: 8/8npm test, full suite) passed on both commits